package com.jk.bgdiscount.controller;

import com.jk.bgdiscount.entity.DiscountEntity;
import com.jk.bgdiscount.service.DiscountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("discount")
public class DiscountController {

    @Resource
    private DiscountService discountService;

    /**
     * @description:  查询用户优惠券类型表
     * @param: []
     * @return: java.util.List<com.jk.bgmainconsumer.entity.DiscountEntity>
     * @author 刘杨彬
     * @date: 2021/9/3 13:21
     */
    @RequestMapping("queryUserDiscount")
    public List<DiscountEntity>queryUserDiscount(){

        return discountService.queryUserDiscount();
    }

    /**
     * @description:  新增用户优惠券类型表
     * @param: [discountEntity]
     * @return: void
     * @author 刘杨彬
     * @date: 2021/9/3 13:23
     */
    @RequestMapping("addDiscount")
    public void addDiscount(@RequestBody DiscountEntity discountEntity){

        discountService.addDiscount(discountEntity);
    }

}
